-
Notifications
You must be signed in to change notification settings - Fork 85
Save scarb execute outputs
#2869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
ccd2120 to
c73263a
Compare
41c979a to
037b8ef
Compare
6b1371c to
0ba8159
Compare
0ba8159 to
a267865
Compare
5023266 to
035f605
Compare
58546ae to
f62beb5
Compare
| if args.run.save_program_output | ||
| && let Some(output) = &execution_output | ||
| { | ||
| let program_output_path = execution_output_dir.join(EXECUTE_PROGRAM_OUTPUT_FILENAME); | ||
| fs::write(program_output_path, output.as_str())?; | ||
| } | ||
|
|
||
| if args.run.save_print_output { | ||
| let print_output_path = execution_output_dir.join(EXECUTE_PRINT_OUTPUT_FILENAME); | ||
| fs::write(print_output_path, &captured_print_output)?; | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder how useful is it, to save this to files, instead of printing to stdout? Can't we just parse the stdout wherever we need to use this? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
I based this off of the decision we made in the past regarding
scarb prove: Addscarb prove#1900 (comment)Although I'm not sure that's super problematic since we have control over the logic of both extensions, I suppose if extracting
NfromSaving output to [..]Nis unstable, then extracting multiline outputs could be considered even less stable 🤔
That's why we useSCARB_EXECUTION_ID, and it seemed reasonable to me not to rethink this here -
Another thing that concerned me - verbosity.
- If we pass verbosity from
doctoexecute, and that verbosity is--quiet, the output is lost - If we force a normal verbosity for
execute, we'd have to captureexecutestdout, and then somehow figure out based ondocverbosity what to print and not to print. Since we'd have only raw text at our disposal, there would be no way to filter out messages based on their intended level anddocverbosity
Maybe there's some elegant solution to this, but I just didn't think it's worth going there since the files should just work 😄
- If we pass verbosity from
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your point, but I don't really think these two are comparable.
For starters, I don't think that using HintProcessor to capture print is reliably what we want. It seems it can be bypassed (see running with bootloader), but also it runs on the assumption that println! it's the only possible way to access stdout (which I am not sure is true).
It shouldn't require any unpredictable parsing, as we can expect the program output to be the last message when run with --program-output flag. We can use json output format in ui, to output it as easily parsable json. We can also do what we do in scarb metadata, that is, run the command with --quite, but set the output to always be printed regardless of verbosity (imho makes sense, if you are explicitly for it to be printed).
handle each vec<felt> as separate print statement
f62beb5 to
84d2481
Compare
Stack
scarb executeoutputs #2869incremental_create_output_dir#2870should_panicandcompile_faildoc-test attributes #2893Save
scarb executeoutput to files so we can embed the outputs inscarb docgenerated docs